home *** CD-ROM | disk | FTP | other *** search
/ Champak 86 / (Vol 86) My Disc.iso / Games / restaurante_1072.swf / scripts / __Packages / Mission.as < prev    next >
Text File  |  2009-04-16  |  19KB  |  504 lines

  1. if(true)
  2. {
  3.    if(true)
  4.    {
  5.       ┬º┬ºpush(false);
  6.    }
  7.    if(!┬º┬ºpop())
  8.    {
  9.       if(true)
  10.       {
  11.          if(true)
  12.          {
  13.             ┬º┬ºpush(false);
  14.          }
  15.          if(!┬º┬ºpop())
  16.          {
  17.             if(!_global.Mission)
  18.             {
  19.                var _loc2_ = _global.Mission = function($id, $mc)
  20.                {
  21.                   this._id = $id;
  22.                   this._mc = $mc;
  23.                   this.terminated = false;
  24.                   this.data = MissionData.DATA[this.__get__id()];
  25.                }.prototype;
  26.                _global.Mission = function($id, $mc)
  27.                {
  28.                   this._id = $id;
  29.                   this._mc = $mc;
  30.                   this.terminated = false;
  31.                   this.data = MissionData.DATA[this.__get__id()];
  32.                }.__get__totalCashes = function()
  33.                {
  34.                   var _loc2_ = 0;
  35.                   var _loc1_ = 0;
  36.                   while(_loc1_ < MissionData.DATA.length)
  37.                   {
  38.                      _loc2_ += MissionData.DATA[_loc1_].cash;
  39.                      _loc1_ = _loc1_ + 1;
  40.                   }
  41.                   return _loc2_;
  42.                };
  43.                _global.Mission = function($id, $mc)
  44.                {
  45.                   this._id = $id;
  46.                   this._mc = $mc;
  47.                   this.terminated = false;
  48.                   this.data = MissionData.DATA[this.__get__id()];
  49.                }.getMission = function()
  50.                {
  51.                   if(Mission._missionObj == null)
  52.                   {
  53.                      trace("µ▓íµ£ëΦÄ╖σÅûσê░Mission∩╝îσ»╣Φ▒íΣ╕║Null");
  54.                      return null;
  55.                   }
  56.                   return Mission._missionObj;
  57.                };
  58.                _global.Mission = function($id, $mc)
  59.                {
  60.                   this._id = $id;
  61.                   this._mc = $mc;
  62.                   this.terminated = false;
  63.                   this.data = MissionData.DATA[this.__get__id()];
  64.                }.terminateCurrent = function()
  65.                {
  66.                   if(Mission._missionObj != null)
  67.                   {
  68.                      Mission._missionObj.terminate();
  69.                   }
  70.                };
  71.                _global.Mission = function($id, $mc)
  72.                {
  73.                   this._id = $id;
  74.                   this._mc = $mc;
  75.                   this.terminated = false;
  76.                   this.data = MissionData.DATA[this.__get__id()];
  77.                }.createMission = function($id, $mc)
  78.                {
  79.                   if($id == undefined)
  80.                   {
  81.                      $id = 0;
  82.                   }
  83.                   if($mc == undefined)
  84.                   {
  85.                      trace("Σ╕ÑΘçìΘöÖΦ»»∩╝Üσê¢σ╗║Missionµù╢µ▓íµ£ëµë╛σê░Θ£ÇΦªüτÜäMovieClip");
  86.                      return null;
  87.                   }
  88.                   Mission.current = $id;
  89.                   Mission._missionObj = new Mission($id,$mc);
  90.                   return Mission._missionObj;
  91.                };
  92.                _global.Mission = function($id, $mc)
  93.                {
  94.                   this._id = $id;
  95.                   this._mc = $mc;
  96.                   this.terminated = false;
  97.                   this.data = MissionData.DATA[this.__get__id()];
  98.                }.missionAgain = function()
  99.                {
  100.                   Mission.root.gotoAndStop("missionSwitch");
  101.                };
  102.                _global.Mission = function($id, $mc)
  103.                {
  104.                   this._id = $id;
  105.                   this._mc = $mc;
  106.                   this.terminated = false;
  107.                   this.data = MissionData.DATA[this.__get__id()];
  108.                }.nextMission = function()
  109.                {
  110.                   if(Mission._missionObj.__get__id() >= Mission.MAXLEVEL)
  111.                   {
  112.                      Mission.allComplete();
  113.                   }
  114.                   else
  115.                   {
  116.                      Mission.root.gotoAndStop(Mission._missionObj.__get__id() + 3);
  117.                   }
  118.                };
  119.                _global.Mission = function($id, $mc)
  120.                {
  121.                   this._id = $id;
  122.                   this._mc = $mc;
  123.                   this.terminated = false;
  124.                   this.data = MissionData.DATA[this.__get__id()];
  125.                }.allComplete = function()
  126.                {
  127.                   Mission.root.gotoAndStop("end");
  128.                };
  129.                _loc2_.refreshDepth = function()
  130.                {
  131.                   function sortFunction(a, b)
  132.                   {
  133.                      if(a._y > b._y)
  134.                      {
  135.                         return 1;
  136.                      }
  137.                      if(a._y < b._y)
  138.                      {
  139.                         return -1;
  140.                      }
  141.                      if(a._x > b._x)
  142.                      {
  143.                         return 1;
  144.                      }
  145.                      return -1;
  146.                   }
  147.                   var _loc3_ = [this.__get__waitress().__get__mc()];
  148.                   var _loc2_ = 0;
  149.                   while(_loc2_ < this.__get__tables().length)
  150.                   {
  151.                      _loc3_.push(this.__get__tables()[_loc2_].mc);
  152.                      _loc2_ = _loc2_ + 1;
  153.                   }
  154.                   _loc3_.sort(sortFunction);
  155.                   _loc3_.push(this.__get__door().__get__mc());
  156.                   if(this.draggingMc)
  157.                   {
  158.                      _loc3_.push(this.draggingMc);
  159.                   }
  160.                   if(this.ui)
  161.                   {
  162.                      _loc3_.push(this.ui);
  163.                   }
  164.                   _loc2_ = 0;
  165.                   while(_loc2_ < _loc3_.length)
  166.                   {
  167.                      _loc3_[_loc2_].swapDepths(this.__get__mc().getNextHighestDepth());
  168.                      _loc2_ = _loc2_ + 1;
  169.                   }
  170.                };
  171.                _loc2_.checkEnd = function()
  172.                {
  173.                   if(this.__get__isEmpty())
  174.                   {
  175.                      this.missionOver();
  176.                   }
  177.                };
  178.                _loc2_.tableCustomersLeave = function(t)
  179.                {
  180.                   if(t.__get__isLove())
  181.                   {
  182.                      this.numLoves = this.numLoves + 1;
  183.                   }
  184.                   this.cashes += t.cashes;
  185.                   if(this.numLoves >= 2)
  186.                   {
  187.                      if(!this.boundHeart)
  188.                      {
  189.                         this.boundAll(1);
  190.                         this.boundHeart = true;
  191.                      }
  192.                   }
  193.                   if(this.__get__isEmpty())
  194.                   {
  195.                      this.missionOver();
  196.                   }
  197.                };
  198.                _loc2_.terminate = function()
  199.                {
  200.                   this.terminated = true;
  201.                   if(this.__get__waitress().tween != null)
  202.                   {
  203.                      this.__get__waitress().tween.stop();
  204.                      this.__get__waitress().tween = null;
  205.                   }
  206.                   this.__get__waitress().__get__mc()._visible = false;
  207.                   if(this.candle)
  208.                   {
  209.                      this.candle.__get__mc().onPress = null;
  210.                   }
  211.                   this.createCandle = function()
  212.                   {
  213.                      trace("Mission is terminated, Don\'t create candle");
  214.                   };
  215.                   if(this.harp)
  216.                   {
  217.                      this.harp.__get__mc().onRelease = null;
  218.                   }
  219.                   this.__get__door().stopAddCustomer();
  220.                   var _loc2_ = 0;
  221.                   while(_loc2_ < this.__get__tables().length)
  222.                   {
  223.                      Table(this.__get__tables()[_loc2_]).__set__status(Table.NOTFULL);
  224.                      _loc2_ = _loc2_ + 1;
  225.                   }
  226.                   trace("mission" + this.__get__id() + " terminated");
  227.                };
  228.                _loc2_.initMission = function()
  229.                {
  230.                   this._tables = [];
  231.                   this._door = new Door(this.__get__mc()[this.data.door.mcName]);
  232.                   this._waitress = new Waitress(this.__get__mc()[this.data.waitress.mcName]);
  233.                   this._kitchen = new Kitchen(this.__get__mc()[this.data.kitchen.mcName],this.data.kitchen);
  234.                   var _loc2_ = 0;
  235.                   while(_loc2_ < this.data.tables.length)
  236.                   {
  237.                      var _loc3_ = this.data.tables[_loc2_];
  238.                      this._tables.push(new Table(this.__get__mc()[_loc3_.mcName],_loc3_));
  239.                      _loc2_ = _loc2_ + 1;
  240.                   }
  241.                   if(MissionData.DATA[this.__get__id()].candle)
  242.                   {
  243.                      this.createCandle();
  244.                   }
  245.                   if(this.harp == null && MissionData.DATA[this.__get__id()].harp)
  246.                   {
  247.                      this.harp = BoundItem.getHarp(this.__get__door().__get__mc(),{_x:-10,_y:-30});
  248.                   }
  249.                   this.refreshDepth();
  250.                };
  251.                _loc2_.boundAll = function(numHearts)
  252.                {
  253.                   trace("bound for all: +" + numHearts);
  254.                   var _loc4_ = this.__get__door().__get__customersArray().concat();
  255.                   var _loc3_ = 0;
  256.                   while(_loc3_ < this.__get__tables().length)
  257.                   {
  258.                      var _loc2_ = 0;
  259.                      while(_loc2_ < Table(this.__get__tables()[_loc3_]).__get__customersArray().length)
  260.                      {
  261.                         _loc4_.push(this.__get__tables()[_loc3_].customersArray[_loc2_]);
  262.                         _loc2_ = _loc2_ + 1;
  263.                      }
  264.                      _loc3_ = _loc3_ + 1;
  265.                   }
  266.                   _loc3_ = 0;
  267.                   while(_loc3_ < _loc4_.length)
  268.                   {
  269.                      Customer(_loc4_[_loc3_]).changeHearts(numHearts);
  270.                      _loc3_ = _loc3_ + 1;
  271.                   }
  272.                   _loc4_ = [];
  273.                };
  274.                _loc2_.getBound = function(bound)
  275.                {
  276.                   switch(bound)
  277.                   {
  278.                      case this.candle:
  279.                         trace("bound for " + bound.__get__table() + ": +" + bound.__get__heartsNum());
  280.                         var _loc2_ = 0;
  281.                         while(_loc2_ < bound.__get__table().__get__numCustomers())
  282.                         {
  283.                            bound.__get__table().__get__customersArray()[_loc2_].changeHearts(bound.__get__heartsNum());
  284.                            _loc2_ = _loc2_ + 1;
  285.                         }
  286.                         this.createCandle();
  287.                         break;
  288.                      case this.harp:
  289.                         _loc2_ = 0;
  290.                         while(_loc2_ < this.__get__door().__get__customersArray().length)
  291.                         {
  292.                            var _loc4_ = Customer(this.__get__door().__get__customersArray()[_loc2_]);
  293.                            _loc4_.changeHearts(bound.__get__heartsNum());
  294.                            _loc2_ = _loc2_ + 1;
  295.                         }
  296.                   }
  297.                };
  298.                _loc2_.createCandle = function()
  299.                {
  300.                   var _loc2_ = Math.random() * 20000 + 10000;
  301.                   var obj = this;
  302.                   var interval = setInterval(function()
  303.                   {
  304.                      if(!obj.terminated)
  305.                      {
  306.                         obj.candle = BoundItem.getCandle(obj.__get__mc(),{_x:obj.__get__kitchen().__get__mc()._x - 100,_y:obj.__get__kitchen().__get__mc()._y + 30});
  307.                      }
  308.                      clearInterval(interval);
  309.                   }
  310.                   ,_loc2_);
  311.                };
  312.                _loc2_.toString = function()
  313.                {
  314.                   return "Mission " + this.__get__id();
  315.                };
  316.                _loc2_.__get__happyTablesNum = function()
  317.                {
  318.                   return this._happyTablesNum;
  319.                };
  320.                _loc2_.__get__kitchen = function()
  321.                {
  322.                   return this._kitchen;
  323.                };
  324.                _loc2_.__get__waitress = function()
  325.                {
  326.                   return this._waitress;
  327.                };
  328.                _loc2_.__get__isEmpty = function()
  329.                {
  330.                   var _loc2_ = 0;
  331.                   while(_loc2_ < this.__get__tables().length)
  332.                   {
  333.                      if(!Table(this.__get__tables()[_loc2_]).__get__isEmpty())
  334.                      {
  335.                         return false;
  336.                      }
  337.                      _loc2_ = _loc2_ + 1;
  338.                   }
  339.                   return this.__get__door().__get__isEmpty();
  340.                };
  341.                _loc2_.__get__door = function()
  342.                {
  343.                   return this._door;
  344.                };
  345.                _loc2_.__get__id = function()
  346.                {
  347.                   return this._id;
  348.                };
  349.                _loc2_.__get__mc = function()
  350.                {
  351.                   return this._mc;
  352.                };
  353.                _loc2_.__get__tables = function()
  354.                {
  355.                   return this._tables;
  356.                };
  357.                _loc2_.missionOver = function()
  358.                {
  359.                   MissionData.DATA[this.__get__id()].cash = this.cashes;
  360.                   if(this.passLimit > this.numLoves)
  361.                   {
  362.                      this.fail();
  363.                   }
  364.                   else
  365.                   {
  366.                      this.pass();
  367.                   }
  368.                   this.terminate();
  369.                };
  370.                _loc2_.fail = function()
  371.                {
  372.                   this.ui = this.__get__mc().attachMovie("UI","ui",this.__get__mc().getNextHighestDepth());
  373.                   this.ui.gotoAndStop("fail");
  374.                   this.ui.loves_txt.text = this.numLoves;
  375.                   this.ui.cash_txt.text = this.cashes;
  376.                   this.ui.again_btn.onRelease = function()
  377.                   {
  378.                      Mission.missionAgain();
  379.                   };
  380.                };
  381.                _loc2_.pass = function()
  382.                {
  383.                   this.ui = this.__get__mc().attachMovie("UI","ui",this.__get__mc().getNextHighestDepth());
  384.                   this.ui.gotoAndStop("pass");
  385.                   this.ui.loves_txt.text = this.numLoves;
  386.                   this.ui.cash_txt.text = this.cashes;
  387.                   this.ui.again_btn.onRelease = function()
  388.                   {
  389.                      Mission.missionAgain();
  390.                   };
  391.                   this.ui.next_btn.onRelease = function()
  392.                   {
  393.                      Mission.nextMission();
  394.                   };
  395.                };
  396.                _loc2_.statusChangedHandle = function(event)
  397.                {
  398.                   if(event.target.CLASS === Customer)
  399.                   {
  400.                      this.customerStatusHandle(event.status);
  401.                   }
  402.                };
  403.                _loc2_.customerStatusHandle = function(s)
  404.                {
  405.                   if(s !== Customer.SIT)
  406.                   {
  407.                   }
  408.                };
  409.                _global.Mission = function($id, $mc)
  410.                {
  411.                   this._id = $id;
  412.                   this._mc = $mc;
  413.                   this.terminated = false;
  414.                   this.data = MissionData.DATA[this.__get__id()];
  415.                }._missionObj = null;
  416.                _global.Mission = function($id, $mc)
  417.                {
  418.                   this._id = $id;
  419.                   this._mc = $mc;
  420.                   this.terminated = false;
  421.                   this.data = MissionData.DATA[this.__get__id()];
  422.                }.root = null;
  423.                _global.Mission = function($id, $mc)
  424.                {
  425.                   this._id = $id;
  426.                   this._mc = $mc;
  427.                   this.terminated = false;
  428.                   this.data = MissionData.DATA[this.__get__id()];
  429.                }.current = 0;
  430.                _global.Mission = function($id, $mc)
  431.                {
  432.                   this._id = $id;
  433.                   this._mc = $mc;
  434.                   this.terminated = false;
  435.                   this.data = MissionData.DATA[this.__get__id()];
  436.                }.MAXLEVEL = 2;
  437.                _loc2_._id = 0;
  438.                _loc2_._happyTablesNum = 0;
  439.                _loc2_.draggingMc = null;
  440.                _loc2_.numLoves = 0;
  441.                _loc2_.passLimit = 2;
  442.                _loc2_.cashes = 0;
  443.                _loc2_.ui = null;
  444.                _loc2_.boundHeart = false;
  445.                _loc2_.harp = null;
  446.                _loc2_.candle = null;
  447.                ┬º┬ºpush(_loc2_.addProperty("door",_loc2_.__get__door,function()
  448.                {
  449.                }
  450.                ));
  451.                ┬º┬ºpush(_loc2_.addProperty("happyTablesNum",_loc2_.__get__happyTablesNum,function()
  452.                {
  453.                }
  454.                ));
  455.                ┬º┬ºpush(_loc2_.addProperty("id",_loc2_.__get__id,function()
  456.                {
  457.                }
  458.                ));
  459.                ┬º┬ºpush(_loc2_.addProperty("isEmpty",_loc2_.__get__isEmpty,function()
  460.                {
  461.                }
  462.                ));
  463.                ┬º┬ºpush(_loc2_.addProperty("kitchen",_loc2_.__get__kitchen,function()
  464.                {
  465.                }
  466.                ));
  467.                ┬º┬ºpush(_loc2_.addProperty("mc",_loc2_.__get__mc,function()
  468.                {
  469.                }
  470.                ));
  471.                ┬º┬ºpush(_loc2_.addProperty("tables",_loc2_.__get__tables,function()
  472.                {
  473.                }
  474.                ));
  475.                ┬º┬ºpush((_global.Mission = function($id, $mc)
  476.                {
  477.                   this._id = $id;
  478.                   this._mc = $mc;
  479.                   this.terminated = false;
  480.                   this.data = MissionData.DATA[this.__get__id()];
  481.                }).addProperty("totalCashes",_global.Mission = function($id, $mc)
  482.                {
  483.                   this._id = $id;
  484.                   this._mc = $mc;
  485.                   this.terminated = false;
  486.                   this.data = MissionData.DATA[this.__get__id()];
  487.                }.__get__totalCashes,function()
  488.                {
  489.                }
  490.                ));
  491.                ┬º┬ºpush(_loc2_.addProperty("waitress",_loc2_.__get__waitress,function()
  492.                {
  493.                }
  494.                ));
  495.                ┬º┬ºpush(ASSetPropFlags(_global.Mission.prototype,null,1));
  496.             }
  497.             ┬º┬ºpop();
  498.          }
  499.       }
  500.       ┬º┬ºgoto(addr1195);
  501.    }
  502. }
  503. addr1195:
  504.